<template>
  <div>
    <div class="confirm_panel">
      <div class="left">
        合计待支付:
        <span class="price">195.89</span>
      </div>
      <div class="right">
        <div class="detail_wrapper" @click="onDetailWrapperClick">
          <span class="detail">明细</span>
          <Icon type="ios-arrow-up" v-if="detailOpen" />
          <Icon type="ios-arrow-down" v-if="detailClose" />
        </div>
        <div class="btn_wrapper">
          <button type="button" class="btn">确认支付</button>
        </div>
      </div>
    </div>
    <!-- 明细内容 -->
    <transition name="fade">
      <div class="detail_content_wrapper" v-if="isDetailContentShow">
        <div class="title">待支付明细</div>
        <div class="section_one">
          <div class="oil_num">
            <span>油号</span>
            <span>92#</span>
          </div>
          <div class="gun_num">
            <span>抢号</span>
            <span>1号枪</span>
          </div>
          <div class="oil_amount">
            <span>输入加油金额</span>
            <span>200</span>
          </div>
          <div class="volumn">
            <span>加油升数</span>
            <span>34.66L</span>
          </div>
        </div>
        <div class="separator"></div>
        <div class="section_two">
          <div class="straight_down">
            <span>直降优惠</span>
            <div class="text_wrapper" @click="onStraightDownDetailClick">
              <span class="text">-4.11</span>
              <Icon type="ios-arrow-up" v-if="straightDownDetailClose" />
              <Icon type="ios-arrow-down" v-if="straightDownDetailOpen" />
            </div>
          </div>
          <transition name="fade">
            <div class="offer_detail_wrapper" v-if="isOrderDetailShow">
              <div>
                <span>优惠券优惠</span>
                <span class="text">0.00</span>
              </div>
              <div>
                <span>合计优惠</span>
                <span class="text">4.11</span>
              </div>
            </div>
          </transition>
        </div>
        <div class="separator"></div>
        <div class="section_three">
          <div class="payment">
            <span>支付方式</span>
            <span>微信公众号支付</span>
          </div>
        </div>
      </div>
    </transition>
    <div class="mask" v-if="isDetailContentShow" @click="onMaskClick"></div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      detailOpen: false,
      detailClose: true,
      isDetailContentShow: false,
      straightDownDetailOpen: false,
      straightDownDetailClose: true,
      isOrderDetailShow: false,
      isShow: false
    };
  },
  methods: {
    onDetailWrapperClick() {
      this.detailOpen = !this.detailOpen;
      this.detailClose = !this.detailClose;
      this.isDetailContentShow = !this.isDetailContentShow;
    },
    onStraightDownDetailClick() {
      this.straightDownDetailOpen = !this.straightDownDetailOpen;
      this.straightDownDetailClose = !this.straightDownDetailClose;
      this.isOrderDetailShow = !this.isOrderDetailShow;
    },
    onMaskClick() {
      this.isDetailContentShow = !this.isDetailContentShow;
    }
  }
};
</script>

<style lang="stylus" scoped>
.confirm_panel {
  position: fixed;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 15px;
  width: 100%;
  height: 50px;
  background: #fff;
  font-size: 18px;
  box-shadow: 0 1px 15px rgba(192, 192, 192, 0.3);
  z-index: 1000;

  .left {
    display: flex;
    align-items: center;

    .price {
      margin-left: 8px;
      font-size: 22px;
      color: red;
    }
  }

  .right {
    display: flex;
    align-items: center;

    .detail_wrapper {
      display: flex;
      align-items: center;
      margin-right: 8px;
      font-size: 12px;
      color: #999999;

      .detail {
        color: #333333;
      }

      .ivu-icon-ios-arrow-up {
      }

      .ivu-icon-ios-arrow-down {
      }
    }

    .btn_wrapper {
      margin-top: 5px;
      box-sizing: content-box;
      width: 100px;
      height: 100%;
    }

    .btn {
      display: block;
      outline: none;
      border: none;
      width: 100%;
      height: 50px;
      background: red;
      color: #ffffff;
    }
  }
}

.detail_content_wrapper {
  position: fixed;
  bottom: 50px;
  width: 100%;
  padding: 15px 15px 0 15px;
  font-size: 12px;
  background: #fff;
  z-index: 1000;

  .title {
    font-weight: 800;
    font-size: 16px;
  }

  .section_one {
    div {
      display: flex;
      justify-content: space-between;
    }
  }

  .section_two {
    div {
      display: flex;
      justify-content: space-between;
    }

    .straight_down {
      .text_wrapper {
        display: flex;
        align-items: center;

        .text {
          color: red;
        }
      }
    }

    .offer_detail_wrapper {
      display: flex;
      flex-direction: column;

      .text {
        color: red;
      }
    }
  }

  .section_three {
    .payment {
      display: flex;
      justify-content: space-between;
    }
  }

  .separator {
    width: 100%;
    height: 1px;
    background: #ededed;
    margin: 8px 0;
  }
}

.mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
}
</style>
